<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改密码</title>
</head>


<e:View id="view">
    <script type="text/javascript" src="<c:url value='/scripts/indexglobal.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/scripts/skin.js'/>"></script>
    <script type="text/javascript">SkinUtil.getSkin();</script>
    <script type="text/javascript">SkinUtil.getModuleSkin();</script>
    
<div id="Invisual Controls" style="min-height: 40px; background-color: LemonChiffon;" >
	<e:Command id="Command_Submit" action="com.longtop.framework.sys.login.web.MainAction" method="changePassword" submitForm="true" showHintInfoOnSuccess="false"
			onExecuteSuccess="Command_Submit_onExecuteSuccess(command)">
			<e:Parameter name="oldPswd" value=""></e:Parameter>
			<e:Parameter name="newPswd" value=""></e:Parameter>
	</e:Command>
</div>

<body onload="loadPage();" style="overflow:hidden">

<e:Page id="ePage" action="" style="min-height: 80px; width: 100%; height: 100%;">
	<table style="width: 100%; height: 100%; vertical-align: top" border="0" cellpadding="2" cellspacing="2" width="100%" align="center">
		<tr>
			<td valign="top" align="center">
				<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" width="80%" align="center">
					<tr>
						<td width="30%" align="right">
							<e:Label id="Label1" caption="输入旧密码"></e:Label>
						</td>
						<td width="70%">
							<e:Text id="Editor_OldPwd" style="width: 200px" editorType="password"></e:Text>
						</td>
					</tr>
					<tr>
						<td align="right">
							<e:Label id="Label2" caption="输入新密码"></e:Label>
						</td>
						<td>
							<e:Text id="Editor_NewPwd" style="width: 200px" editorType="password"></e:Text>
						</td>
					</tr>
					<tr>
						<td align="right">
							<e:Label id="Label3" caption="重复新密码"></e:Label>
						</td>
						<td>
							<e:Text id="Editor_NewPwd2" style="width: 200px" editorType="password"></e:Text>
						</td>
					</tr>
					<tr>
						<td>
							<e:Text id="Editor_UserId" visible="false"></e:Text>
						</td>
						<td align="left">
							<e:Button id="Button_Submit" caption="确定" icon="/images/submit.gif" style="width: 60px; height: 20px" onClick="Button_Submit_onClick()"></e:Button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<e:Button id="Button_Cancel" caption="取消" icon="/images/undo.gif" style="width: 60px; height: 20px" onClick="Button_Cancel_onClick()"></e:Button>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</e:Page>

</body>
</e:View>
</html>

<script type="text/javascript">

function Button_Submit_onClick(){
	var oldpwd = Editor_OldPwd.value;
	var newpwd = Editor_NewPwd.value;
    var newpwd2 = Editor_NewPwd2.value;
    if (oldpwd.trim() == "") {
        MsgBox.showInfoMsg("旧密码不能为空或全为空格，请输入旧密码！");
        Editor_OldPwd.focus();
        return false;
    }
    if (newpwd.trim() == "") {
        MsgBox.showInfoMsg("新密码不能为空或全为空格，请输入新密码！");
        Editor_NewPwd.focus();
        return false;
    }
    if (newpwd != newpwd2) {
        MsgBox.showInfoMsg("两次输入的新密码不同,请重新输入！");
        return false;
    }
    if (newpwd == oldpwd) {
        MsgBox.showInfoMsg("新密码和旧密码相同,请重新输入！");
        return false;
    }
    Command_Submit.parameters.setValue("oldPswd",oldpwd);
    Command_Submit.parameters.setValue("newPswd",newpwd);
    
	Command_Submit.execute();
}

function Button_Cancel_onClick(){
	window.close();
}
function loadPage(){
        Editor_UserId.value = "<c:out value="${sessionObject.userId}"/>";
		Editor_OldPwd.focus();
}

function Command_Submit_onExecuteSuccess(command){
	closeWin = function (){
		window.close();
	}	
	if(Command_Submit.getResponseStatus()){
		var msg=Command_Submit.getResponseMessage();
		MsgBox.showInfoMsg(msg,"",[closeWin]);
	}
}
</script>
